package com.jzo2o.customer.controller.operation;

import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.model.domain.AgencyCertificationAudit;
import com.jzo2o.customer.model.domain.WorkerCertificationAudit;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.service.IAgencyCertificationAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author itlxc
 * @since 2024-10-15
 */
@RestController("operationAgencyWorkerCertificationAuditController")
@RequiredArgsConstructor
@RequestMapping("/operation/agency-certification-audit")
@Api(tags = "机构人员认证审核相关接口")
@Slf4j
public class AgencyWorkerCertificationAuditController {

    private final IAgencyCertificationAuditService agencyCertificationAuditService;

    @GetMapping("/page")
    @ApiOperation("审核机构认证分页查询")
    public PageResult<AgencyCertificationAudit> pageQuery(AgencyCertificationAuditPageQueryReqDTO dto) {
        log.info("审核机构认证分页查询参数：{}", dto);
        return agencyCertificationAuditService.pageQuery(dto);
    }

    @PutMapping("/audit/{id}")
    @ApiOperation("审核机构认证信息")
    public void audit(@PathVariable("id") Long id, Integer certificationStatus, String rejectReason) {
        log.info("审核机构认证信息，id:{},certificationStatus:{},rejectReason:{}", id, certificationStatus, rejectReason);
        agencyCertificationAuditService.audit(id, certificationStatus, rejectReason);
    }
}
